Skip to content

Look up a configured program named alone without the program's folder - #36

Merged
geeooff merged 1 commit into
mainfrom
program-search
Nov 24, 2026
Merged

geeooff merged 1 commit into
mainfrom
program-search

Conversation

@geeooff

@geeooff geeooff commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Stacked on #35 (dll-search): GitHub retargets this PR to main once #35 is merged and its branch deleted.

What

A command's program given as a name alone (schtasks.exe in the FanControl recipe, powercfg.exe, powershell.exe) went to std's search, which looks in the running executable's own folder before the system folder and PATH (Command::new). A copy unpacked in Downloads would have run a schtasks.exe lying beside it at every game start and stop.

actions::locate now resolves a bare name itself, in std's order without that folder:

  1. the PATH the command's own env sets, if any;
  2. the system folder (win::system_dir);
  3. the Windows folder (win::windows_dir, new, GetWindowsDirectoryW);
  4. the process's PATH.

Only absolute PATH entries count, the current folder never does, and .exe is added to a name with no dot (std's rule). A program given with a folder starts as written. The log's Starting a command line gains path, the file started.

The recipes keep their bare names: with this change they are safe, and a hard-coded C:\Windows\System32\... would not be portable.

Measured

trigger start with a scratch configuration (program = "schtasks.exe") and a stand-in schtasks.exe beside each copy, in a scratch folder:

Build Started Stand-in's marker
909f77b7 (#35, installed here) the stand-in 1
this branch C:\WINDOWS\system32\schtasks.exe 0

build.ps1 test and build OK; 8 unit tests for the rule (system folder before PATH, the copy's own folder and relative entries never, .exe only without an extension, the command's PATH first, quoted PATH entries, a path-like program untouched, empty and not found are errors).

Not verified yet

  • The field check: the next game session's log should show path=C:\WINDOWS\system32\schtasks.exe for the maintainer's commands.

Docs

Reference (program row), Getting started, How it works, config.example.toml, CHANGELOG Fixed, a dated note in docs/design/08-distribution.md, and AGENTS.md's pitfall line.

🤖 Generated with Claude Code

A command's `program` given as a bare name went to std's search, which
looks in the running executable's own folder before the system folder
and PATH (`Command::new`). With the FanControl recipe, a copy unpacked
in Downloads would have run a schtasks.exe lying beside it at every game
start and stop.

actions::locate now resolves a bare name itself, in std's order without
that folder: the command's own PATH, the system folder, the Windows
folder (win::windows_dir, beside system_dir), the process's PATH,
absolute entries only, .exe added to a name with no dot. A program given
with a folder starts as written. The log names the file started.

Measured with `trigger start` and a stand-in schtasks.exe beside each
copy: build 909f77b7 ran the stand-in, this one System32's. The recipes
keep their bare names.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@geeooff
geeooff deleted the branch dll-search November 24, 2026 10:59
@geeooff geeooff closed this Nov 24, 2026
@geeooff geeooff reopened this Nov 24, 2026
@geeooff
geeooff changed the base branch from dll-search to main November 24, 2026 11:00
@geeooff
geeooff enabled auto-merge November 24, 2026 11:00
@geeooff
geeooff merged commit 0bddcea into main Nov 24, 2026
4 checks passed
@geeooff
geeooff deleted the program-search branch November 24, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant